#include("/static/themes/dolphin/layout/layout.html")
#@layout()
#define css()
<link rel="stylesheet" href="/static/themes/dolphin/css/timeline.css" />
#end
#define content()
<div class="doc-container" id="doc-container">
    <div class="container-fixed">
        <div class="timeline-box shadow">
            <div class="timeline-main">
                <h1><i class="fa fa-clock-o"></i>日记</h1>
                <div class="timeline-line"></div>
                <div class="timeline-year">
                    <div class="timeline-month">
                        <ul id="LAY">
                        </ul>
                    </div>
                </div>
                <h1 style="padding-top:4px;padding-bottom:2px;margin-top:40px;"><i class="fa fa-hourglass-end"></i>THE
                    END</h1>
            </div>
        </div>
    </div>
</div>
#end
#define js()
<script>
    Date.prototype.format = function(fmt) {
        var o = {

            "M+" : this.getMonth()+1,                 //月份

            "d+" : this.getDate(),                    //日

            "h+" : this.getHours(),                   //小时

            "m+" : this.getMinutes(),                 //分

            "s+" : this.getSeconds(),                 //秒

            "q+" : Math.floor((this.getMonth()+3)/3), //季度

            "S"  : this.getMilliseconds()             //毫秒

        };
        if(/(y+)/.test(fmt)) {

            fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));

        }
        for(var k in o) {

            if(new RegExp("("+ k +")").test(fmt)){

                fmt = fmt.replace(RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));

            }

        }
        return fmt;
    };

    layui.use('flow', function () {
        var flow = layui.flow;
        flow.load({
            elem: '#LAY' //流加载容器
            , done: function (page, next) { //执行下一页的回调
                var lis = [];
                $.get("/api/journal/list?pageSize=10&pageIndex=" + page,function (data) {
                    var list = data.data;
                    for(var vo of list){
                      var str = "<li>" +
                          "     <div class=\"h4 animated fadeInLeft\">" +
                          "          <p class=\"date\">"+new Date(vo.createTime).format("yyyy-MM-dd hh:mm:ss")+"</p>" +
                          "     </div>" +
                          "      <p class=\"dot-circle animated \"><i class=\"fa fa-dot-circle-o\"></i></p>" +
                          "      <div class=\"content animated fadeInRight details-content\">"+vo.content+"</div>" +
                          "       <div class=\"clear\"></div>" +
                          "  </li>"
                        lis.push(str);
                    }
                    next(lis.join(''), page*10 < data.total);
                });
            }
        });
    });
</script>
#end
